import java.util.*;
public class _12121{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t= in.nextInt();
        int a[]= new int[100000];
        for(int q=0;q<t;q++){
            int n = in.nextInt();
            int max=0;
            int min=100000000;
            long nmax=0,nmin=0;
            for(int e=0;e<n;e++){
                a[e]=in.nextInt();
                if(a[e]==max){
                    nmax++;
                }
                if(a[e]==min){
                    nmin++;
                }
                if(a[e]>max){
                    max=a[e];
                    nmax=1;
                }
                if(a[e]<min){
                    min=a[e];
                    nmin=1;
                }
            }
            System.out.println(nmax);
            System.out.println(nmin);
            if(max==min){
                System.out.println((n*(n-1)));
            }else{
                Long m=nmax*nmin*2;
                System.out.println(m);
            }
            
        }
    }
}